home *** CD-ROM | disk | FTP | other *** search
- (*===========================================================================*)
- (* Display routes *)
- (* *)
- (* Copyright 1992 by H. Roy Engehausen. All rights reserved. *)
- (* *)
- (*===========================================================================*)
-
- (*===========================================================================*)
- (* Display routes *)
- (*===========================================================================*)
-
- PROCEDURE disp_route(cmd_in : STRING);
-
- VAR
- found : BOOLEAN;
- inx : BYTE;
- j : BYTE;
- match_me : str15;
- s : str8;
- this_dblk : msg_d_ptr;
- this_msg : msg_index_ptr;
- this_route : msg_r_ptr;
-
- LABEL
- chain_next_route;
-
- BEGIN;
-
- (*-----------------------------------------------------------------------*)
- (* Check the command for validity *)
- (*-----------------------------------------------------------------------*)
-
- upcase_str_var(cmd_in);
-
- inx := WORDS(cmd_in);
-
- IF inx > 2 THEN
- BEGIN;
- send_message(message_err_wrd);
- active_tcb^.error_sw := TRUE;
- EXIT;
- END;
-
- (*-----------------------------------------------------------------------*)
- (* Extract the search pattern *)
- (*-----------------------------------------------------------------------*)
-
- match_me := subword(@cmd_in, 2, 1);
-
- (*-----------------------------------------------------------------------*)
- (* Initialize *)
- (*-----------------------------------------------------------------------*)
-
- found := FALSE;
-
- this_route := msg_route_list;
-
- (*-----------------------------------------------------------------------*)
- (* Nothing to do???? *)
- (*-----------------------------------------------------------------------*)
-
- IF this_route = NIL THEN
- send_tnc_data_str('No active routes' + cr);
-
- (*-----------------------------------------------------------------------*)
- (* Loop thru routes *)
- (*-----------------------------------------------------------------------*)
-
- WHILE this_route <> NIL DO
- BEGIN;
-
- (*-------------------------------------------------------------------*)
- (* Get number of paths from this route *)
- (*-------------------------------------------------------------------*)
-
- j := this_route^.msg_r_routes;
-
- (*-------------------------------------------------------------------*)
- (* Look for a match *)
- (*-------------------------------------------------------------------*)
-
- inx := 1;
-
- IF match_me <> '' THEN
- WHILE (inx <= j)
- AND NOT match_str(SUBWORD(@this_route^.msg_r_info, inx, 1),
- match_me) DO
- INC(inx);
-
- (*-------------------------------------------------------------------*)
- (* If no match, chain to next *)
- (*-------------------------------------------------------------------*)
-
- IF inx > j THEN
- GOTO chain_next_route;
-
- (*-------------------------------------------------------------------*)
- (* Match found *)
- (*-------------------------------------------------------------------*)
-
- found := TRUE;
-
- (*-------------------------------------------------------------------*)
- (* Display route info *)
- (*-------------------------------------------------------------------*)
-
- cmd_in := this_route^.msg_r_info;
- strip_var(cmd_in, 'B');
- set_dollar1_parm (@cmd_in);
-
- send_message(message_routed_to);
-
- (*-------------------------------------------------------------------*)
- (* Find a message for this route *)
- (*-------------------------------------------------------------------*)
-
- this_msg := find_next_msg(this_route, NIL, inx);
-
- (*-------------------------------------------------------------------*)
- (* Handle special case of none found *)
- (*-------------------------------------------------------------------*)
-
- IF this_msg = NIL THEN
- BEGIN;
- send_tnc_data_str(' No messages found' + cr);
- GOTO chain_next_route;
- END;
-
- (*-------------------------------------------------------------------*)
- (* Loop thru all the messages *)
- (*-------------------------------------------------------------------*)
-
- REPEAT
-
- (*-----------------------------------------------------------------*)
- (* Get the message number *)
- (*-----------------------------------------------------------------*)
-
- STR(this_msg^.msg_i_mb.msg_number, cmd_in);
- cmd_in := ' ' + this_msg^.msg_i_mb.msg_type
- + ' # ' + cmd_in + ' => ';
-
- (*-----------------------------------------------------------------*)
- (* Distribution or no distribution list *)
- (*-----------------------------------------------------------------*)
-
- IF inx = 0 THEN
- BEGIN;
-
- (*-------------------------------------------------------------*)
- (* Direct routing. No distribution list *)
- (*-------------------------------------------------------------*)
-
- (*-------------------------------------------------------------*)
- (* Look at "@" field to determine display *)
- (*-------------------------------------------------------------*)
-
- IF this_msg^.msg_i_mb.msg_to_at <> '' THEN
- BEGIN;
-
- (*---------------------------------------------------------*)
- (* "@" field non blank. Display @xxxx.xx.xx.xx *)
- (*---------------------------------------------------------*)
-
- cmd_in := cmd_in + this_msg^.msg_i_mb.msg_to_at;
- IF this_msg^.msg_i_mb.msg_to_h <> '' THEN
- cmd_in := cmd_in + '.' + this_msg^.msg_i_mb.msg_to_h;
-
- END
- ELSE
-
- (*---------------------------------------------------------*)
- (* "@" field blank. Display to@ *)
- (*---------------------------------------------------------*)
-
- cmd_in := cmd_in + this_msg^.msg_i_mb.msg_to + '@';
- END
- ELSE
- BEGIN;
-
- (*-------------------------------------------------------------*)
- (* Distribution list. Display data *)
- (*-------------------------------------------------------------*)
-
- this_dblk := find_dist_list(this_msg);
- IF (inx <= this_dblk^.msg_d_no) AND (inx > 0) THEN
- cmd_in := cmd_in + this_dblk^.msg_d_array[inx].msg_d_info
- ELSE
- BEGIN;
- STR(this_msg^.msg_i_mb.msg_number, s);
- cmd_in := cmd_in + '** Invalid dist = ' + s;
- END;
-
- END;
-
- (*-----------------------------------------------------------------*)
- (* Send output *)
- (*-----------------------------------------------------------------*)
-
- send_tnc_data_str(cmd_in + cr);
-
- (*-----------------------------------------------------------------*)
- (* Chain to next message *)
- (*-----------------------------------------------------------------*)
-
- this_msg := find_next_msg(this_route, this_msg, inx);
-
- UNTIL this_msg = NIL;
-
- (*-------------------------------------------------------------------*)
- (* Chain to next route *)
- (*-------------------------------------------------------------------*)
-
- chain_next_route:
-
- this_route := this_route^.msg_r_next;
-
- END;
-
- (*-----------------------------------------------------------------------*)
- (* Send final message *)
- (*-----------------------------------------------------------------------*)
-
- IF NOT found THEN
- send_tnc_data_str('No routes matched your search' + cr)
- ELSE
- send_message(message_op_complete);
-
- END;